#include <iostream>
#include <cstdio>
using namespace std;

const int maxn = 1000005;

inline char getc() {
    static char buf[1 << 18], *fs, *ft;
    return (fs == ft && (ft = (fs = buf) + fread(buf, 1, 1 << 18, stdin)), fs == ft) ? EOF : *fs++;
}

inline int gn() {
    static char c;
    static int k;
    k = 0, c = getc();
    for (; !isdigit(c); c = getc());
    for (; isdigit(c); c = getc()) k = k * 10 + c - '0';
    return k;
}

int sum, l, n, f, ans, a[maxn], _3 = 1;

int main() {
#ifndef LOCAL
    freopen("tickets.in", "r", stdin);
    freopen("tickets.out", "w", stdout);
#endif
    n = gn(), f = gn();
    if (f == 10 || f == 100) _3 = 0; // 特判
    for (int i = 1; i <= n; i++) {
        sum += (a[i] = gn());
        if (sum <= f) ans = max(ans, i - l);
        else while (sum >= f) sum -= a[l++];
    }
    cout << ans + _3 << endl;
}